package data_structure;

public class leetcode_0513 {
    public int findBottomLeftValue(TreeNode root) {
        int[] num=new int[2];
        num[0]=root.val;
        num[1]=0;
        value(num,root,0);
        return num[0];
    }
    public void value(int[] num,TreeNode node,int deep){
        if(deep>=num[1]){
            num[1]=deep;
            num[0]=node.val;
        }
        if(node.right!=null){
            value(num,node.right,deep+1);
        }
        if(node.left!=null){
            value(num,node.left,deep+1);
        }
    }
}
